﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EMoney.IStock.Client.Models.QQ
{
    /// <summary>
    /// 用户资产信息
    /// </summary>
    [Serializable]
    public class Assets : QQCommon
    {
        public AssetsData data { get; set; }
    }

    [Serializable]
    public class AssetsData
    {
        /// <summary>
        /// 初始资金
        /// </summary>
        public string raw_assets { get; set; }
        /// <summary>
        /// 现金余额
        /// </summary>
        public string cash_assets { get; set; }
        /// <summary>
        /// 市值
        /// </summary>
        public string total_sz { get; set; }
        /// <summary>
        /// 总资产
        /// </summary>
        public string total_zc { get; set; }
        /// <summary>
        /// 盈亏
        /// </summary>
        public string yinkui { get; set; }
        /// <summary>
        /// 仓位
        /// </summary>
        public string cangwei { get; set; }
        /// <summary>
        /// 总排名
        /// </summary>
        public string rankIndex { get; set; }
        /// <summary>
        /// 周排名
        /// </summary>
        public string rankDayIndex { get; set; }
        /// <summary>
        /// 日排名
        /// </summary>
        public string rankWeekIndex { get; set; }
        /// <summary>
        /// 总收益率
        /// </summary>
        public decimal totalrate 
        {
            get 
            {
                decimal rate = 0;

                try
                {
                    decimal zc = decimal.Parse(total_zc);
                    decimal raw = decimal.Parse(raw_assets);

                    rate = (zc - raw) / raw * 100;
                }
                catch { }
                
                return rate; 
            } 
        }
    }
}
